####
# Rust Stuff
####
subdir('core')
subdir('ndata')
subdir('gettext')
subdir('log')
subdir('renderer')
subdir('toolkit')
subdir('physics')
subdir('pluginmgr')
subdir('utils')
#subdir('pluginmgr-cli')
subdir('pluginmgr-gui')
source_rust = files(
   'core/src/lib.rs',
   'core/src/ntime.rs',
   'core/src/nxml.rs',
   'core/src/start.rs',
   'core/src/lua.rs',
   'core/src/constants.rs',
   'utils/src/lib.rs',
   'utils/src/atomicfloat.rs',
   'ndata/src/lib.rs',
   'ndata/src/env.rs',
   'ndata/src/lua.rs',
   'ndata/src/physfs.rs',
   'ndata/src/cwrap.rs',
   'gettext/src/lib.rs',
   'log/src/lib.rs',
   'log/src/version.rs',
   'renderer/src/lib.rs',
   'renderer/src/buffer.rs',
   'renderer/src/sdf.rs',
   'renderer/src/shader.rs',
   'renderer/src/texture.rs',
   'renderer/src/camera.rs',
   'renderer/src/colour.rs',
   'toolkit/src/lib.rs',
   'toolkit/src/widget.rs',
   'physics/src/lib.rs',
   'physics/src/collide.rs',
   'physics/src/vec2.rs',
   'pluginmgr/src/lib.rs',
   'pluginmgr/src/plugin.rs',
   'pluginmgr/src/install.rs',
   'pluginmgr/src/git.rs',
   'pluginmgr-gui/src/lib.rs',
   'array.rs',
   'damagetype.rs',
   'faction.rs',
   'input.rs',
   'linebreak.rs',
   'model.rs',
   'naev.rs',
   'nebula.rs',
   'nlua.rs',
   'plugin.rs',
   'outfit.rs',
   'rng.rs',
   'ship.rs',
   'slots.rs',
   'lua/ryaml.rs',
)
####
# C Source lists
####
source = files(
   'array.c',
   'asteroid.c',
   'background.c',
   'base64.c',
   'board.c',
   'claim.c',
   'collision.c',
   'colour.c',
   'comm.c',
   'commodity.c',
   'cond.c',
   'conf.c',
   'console.c',
   'constants.c',
   'cmark_wrap.c',
   'debris.c',
   'debug.c',
   'debug_fpu.c',
   'dev_diff.c',
   'dev_mapedit.c',
   'dev_spob.c',
   'dev_sysedit.c',
   'dev_system.c',
   'dev_uniedit.c',
   'dialogue.c',
   'difficulty.c',
   'economy.c',
   'effect.c',
   'env.c',
   'equipment.c',
   'escort.c',
   'event.c',
   'explosion.c',
   'faction.c',
   'font.c',
   'gatherable.c',
   'gettext.c',
   'glad.c',
   'gltf.c',
   'gui.c',
   'gui_omsg.c',
   'gui_osd.c',
   'hook.c',
   'info.c',
   'input.c',
   'intlist.c',
   'joystick.c',
   'land.c',
   'land_outfits.c',
   'land_shipyard.c',
   'land_trade.c',
   'load.c',
   'lua_enet.c',
   'lutf8lib.c',
   'lvar.c',
   'map.c',
   'map_find.c',
   'map_overlay.c',
   'map_system.c',
   'mat3.c',
   'mat4.c',
   'md5.c',
   'menu.c',
   'mission.c',
   'msgcat.c',
   'music.c',
   'naevpedia.c',
   'naev_version.c',
   'ndata.c',
   'news.c',
   'nfile.c',
   'nlua.c',
   'nmath.c',
   'nopenal.c',
   'npc.c',
   'nstring.c',
   'nxml.c',
   'nxml_lua.c',
   'opengl.c',
   'opengl_render.c',
   'opengl_shader.c',
   'opengl_tex.c',
   'opengl_vbo.c',
   'options.c',
   'outfit.c',
   'pause.c',
   'perlin.c',
   'physfs_archiver_blacklist.c',
   'physics.c',
   'pilot.c',
   'pilot_cargo.c',
   'pilot_ew.c',
   'pilot_hook.c',
   'pilot_outfit.c',
   'pilot_ship.c',
   'pilot_weapon.c',
   'player.c',
   'player_autonav.c',
   'player_fleet.c',
   'player_gui.c',
   'player_inventory.c',
   'quadtree.c',
   'queue.c',
   'render.c',
   'safelanes.c',
   'save.c',
   'ship.c',
   'shiplog.c',
   'shipstats.c',
   'sound.c',
   'space.c',
   'spfx.c',
   'tech.c',
   'threadpool.c',
   'toolkit.c',
   'unidiff.c',
   'union_find.c',
   'utf8.c',
   'vec2.c',
   'vec3.c',
   'weapon.c',
   'tk/widget/input.c',
   'tk/widget/image.c',
   'tk/widget/cust.c',
   'tk/widget/rect.c',
   'tk/widget/tabwin.c',
   'tk/widget/fader.c',
   'tk/widget/checkbox.c',
   'tk/widget/imagearray.c',
   'tk/widget/button.c',
   'tk/widget/text.c',
   'tk/widget/list.c',
)

nlua_source = files(
   'ai.c',
   'nlua_asteroid.c',
   'nlua_audio.c',
   'nlua_bkg.c',
   'nlua_camera.c',
   'nlua_canvas.c',
   'nlua_cli.c',
   'nlua_commodity.c',
   'nlua_data.c',
   'nlua_diff.c',
   'nlua_evt.c',
   'nlua_faction.c',
   'nlua_file.c',
   'nlua_font.c',
   'nlua_gfx.c',
   'nlua_gui.c',
   'nlua_hook.c',
   'nlua_jump.c',
   'nlua_linopt.c',
   'nlua_munition.c',
   'nlua_misn.c',
   'nlua_music.c',
   'nlua_naev.c',
   'nlua_news.c',
   'nlua_outfit.c',
   'nlua_pilot.c',
   'nlua_pilotoutfit.c',
   'nlua_player.c',
   'nlua_rnd.c',
   'nlua_safelanes.c',
   'nlua_shader.c',
   'nlua_ship.c',
   'nlua_shiplog.c',
   'nlua_spfx.c',
   'nlua_spob.c',
   'nlua_system.c',
   'nlua_tex.c',
   'nlua_time.c',
   'nlua_tk.c',
   'nlua_transform.c',
   'nlua_var.c',
)

sdf_source = files('distance_field.c', 'edtaa3func.c')
mac_source = files('glue_macos.m')

naev_source = [
   files('naev.c'),
   source,
   nlua_source
]

# Headers aren't needed for running the builds,
# as they can all be found in the defined include derectories.
# These are only used to let Meson know that Doxygen needs to be
# re-run when these files change.
headers = files(
   'ai.h',
   'array.h',
   'asteroid.h',
   'background.h',
   'base64.h',
   'board.h',
   'camera.h',
   'claim.h',
   'collision.h',
   'colour.h',
   'comm.h',
   'commodity.h',
   'cond.h',
   'conf.h',
   'console.h',
   'constants.h',
   'cmark_wrap.h',
   'damagetype.h',
   'debris.h',
   'debug.h',
   'dev_diff.h',
   'dev_mapedit.h',
   'dev_spob.h',
   'dev_sysedit.h',
   'dev_system.h',
   'dev_uniedit.h',
   'distance_field.h',
   'dialogue.h',
   'difficulty.h',
   'economy.h',
   'effect.h',
   'edtaa3func.h',
   'equipment.h',
   'escort.h',
   'env.h',
   'event.h',
   'explosion.h',
   'faction.h',
   'font.h',
   'gatherable.h',
   'gettext.h',
   'glad.h',
   'gltf.h',
   'glue_macos.h',
   'gui.h',
   'gui_omsg.h',
   'gui_osd.h',
   'hook.h',
   'info.h',
   'input.h',
   'intlist.h',
   'joystick.h',
   'khrplatform.h',
   'land.h',
   'land_outfits.h',
   'land_shipyard.h',
   'land_trade.h',
   'load.h',
   'log.h',
   'lua_enet.h',
   'lutf8lib.h',
   'lvar.h',
   'map.h',
   'mapData.h',
   'map_find.h',
   'map_overlay.h',
   'map_system.h',
   'mat3.h',
   'mat4.h',
   'md5.h',
   'menu.h',
   'mission.h',
   'mission_markers.h',
   'msgcat.h',
   'music.h',
   'naev.h',
   'naevpedia.h',
   'ndata.h',
   'nebula.h',
   'news.h',
   'nfile.h',
   'nlua.h',
   'nlua_asteroid.h',
   'nlua_audio.h',
   'nlua_bkg.h',
   'nlua_camera.h',
   'nlua_canvas.h',
   'nlua_cli.h',
   'nlua_colour.h',
   'nlua_commodity.h',
   'nlua_data.h',
   'nlua_diff.h',
   'nlua_evt.h',
   'nlua_faction.h',
   'nlua_file.h',
   'nlua_font.h',
   'nlua_gfx.h',
   'nlua_gui.h',
   'nlua_hook.h',
   'nlua_jump.h',
   'nlua_linopt.h',
   'nlua_munition.h',
   'nlua_misn.h',
   'nlua_music.h',
   'nlua_naev.h',
   'nlua_news.h',
   'nlua_outfit.h',
   'nlua_pilot.h',
   'nlua_pilotoutfit.h',
   'nlua_player.h',
   'nlua_rnd.h',
   'nlua_safelanes.h',
   'nlua_shader.h',
   'nlua_ship.h',
   'nlua_shiplog.h',
   'nlua_spfx.h',
   'nlua_spob.h',
   'nlua_system.h',
   'nlua_tex.h',
   'nlua_time.h',
   'nlua_tk.h',
   'nlua_transform.h',
   'nlua_var.h',
   'nlua_vec2.h',
   'nluadef.h',
   'nmath.h',
   'nopenal.h',
   'npc.h',
   'nstring.h',
   'ntracing.h',
   'ntime.h',
   'nxml.h',
   'nxml_lua.h',
   'opengl.h',
   'opengl_render.h',
   'opengl_shader.h',
   'opengl_tex.h',
   'opengl_vbo.h',
   'options.h',
   'outfit.h',
   'pause.h',
   'perlin.h',
   'SDL_PhysFS.h',
   'physfs_archiver_blacklist.h',
   'physics.h',
   'pilot.h',
   'pilot_cargo.h',
   'pilot_ew.h',
   'pilot_hook.h',
   'pilot_outfit.h',
   'pilot_ship.h',
   'pilot_weapon.h',
   'player.h',
   'player_autonav.h',
   'player_fleet.h',
   'player_gui.h',
   'player_inventory.h',
   'plugin.h',
   'quadtree.h',
   'queue.h',
   'render.h',
   'rng.h',
   'safelanes.h',
   'save.h',
   'ship.h',
   'shiplog.h',
   'shipstats.h',
   'slots.h',
   'sound.h',
   'space.h',
   'space_fdecl.h',
   'spfx.h',
   'start.h',
   'target.h',
   'tech.h',
   'threadpool.h',
   'tk/toolkit_priv.h',
   'tk/widget.h',
   'tk/widget/button.h',
   'tk/widget/checkbox.h',
   'tk/widget/cust.h',
   'tk/widget/fader.h',
   'tk/widget/image.h',
   'tk/widget/imagearray.h',
   'tk/widget/input.h',
   'tk/widget/list.h',
   'tk/widget/rect.h',
   'tk/widget/tabwin.h',
   'tk/widget/text.h',
   'toolkit.h',
   'unidata.h',
   'unidiff.h',
   'union_find.h',
   'utf8.h',
   'valgrind.h',
   'vec2.h',
   'vec3.h',
   'weapon.h'
)

#cbindgen = find_program('cbindgen')
#cbindgen_toml =  meson.project_source_root() / 'utils' / 'build' / 'cbindgen.toml'
#rust_headers = custom_target(
#   'generate_shaders',
#   command: [cbindgen, '--config', cbindgen_toml, '@INPUT@' ],
#   capture: true,
#   input: 'slots.rs',
#   output: 'slots.h',
#)
